import request from "@/utils/service"

// 获取推荐歌单分类
export const getRecommendSongCategoryAPI = (limit: number, cat = "古风") => {
  return request.get<any, any>(`/top/playlist?limit=${limit}&cat=${cat ? cat : ""}`)
}
// 获取推荐歌单
export const getRecommendSongAPI = (limit: number, before?: number) => {
  return request.get<any, any>(`/top/playlist/highquality?limit=${limit}&before=${before ? before : 0}`)
}

// 获取歌手分类
export const getSingerCategoryAPI = (limit: number, cat?: string) => {
  return request.get<any, any>(`/artist/list?limit=${limit}&cat=${cat ? cat : ""}`)
}

// 获取歌单详情
export const getSongCategoryDetailAPI = (id: number) => {
  return request.get<any, any>(`/playlist/detail?id=${id}`)
}

// 获取音乐详情
export const getMusicDetailAPI = (ids: number[]) => {
  const id = ids.join(",")
  return request.get<any, any>(`/song/url?id=${id}`)
}

// 获取歌词
export const getMusicLyricAPI = (id: number) => {
  return request.get<any, any>(`/lyric?id=${id}`)
}

// 获取热搜列表
export const getHotSearchAPI = () => {
  return request.get<any, any>(`/search/hot/detail`)
}

// 获取搜索建议
export const getSearchSuggestAPI = (key: string) => {
  return request.get<any, any>(`/search/suggest?keywords=${key}`)
}

// 搜索
export const searchAPI = (key: string, limit: number, offset: number) => {
  return request.get<any, any>(`/search?keywords=${key}&limit=${limit}&offset=${offset}`)
}

// 查看是否有版权
export const checkMusicAPI = (id: number) => {
  return request.get<any, any>(`/check/music?id=${id}`)
}

// 下载歌曲

export const downLoadMusicAPI = (id: number) => {
  return request.get<any, any>(`/song/download/url?id=${id}`)
}
